package com.basker.pisces.orm.data.meta;

import org.springframework.util.Assert;

import lombok.Getter;

@Getter
public class IndexMeta {

    private String name;
    private String[] fieldNames;

    public IndexMeta(String name, String... fieldNames) {
        Assert.hasText(name, "parameter 'name' is required");
        Assert.notEmpty(fieldNames, "parameter 'fieldNames' is required");

        this.name = name;
        this.fieldNames = fieldNames;
    }

    public String getFieldName() {
        return this.fieldNames[0];
    }

    public boolean isUnified() {
        return this.fieldNames.length == 1;
    }
}
